# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit games

DESCRIPTION="Quarry is a multi-purpose GUI for several board games, at present Go, Amazons and Reversi (a.k.a. Othello.)"
HOMEPAGE="http://home.gna.org/quarry/"
SRC_URI="http://download.gna.org/quarry/${P}.tar.gz"

KEYWORDS="~x86"
LICENSE="GPL-2"
SLOT="0"
IUSE="nls"

DEPEND=">=x11-libs/gtk+-2.0
	>=gnome-base/librsvg-2.5"

src_compile() {
	sed -i -e 's,$(datadir)/omf,$(datadir)/../omf,' ${WORKDIR}/quarry-0.2.0/build/omf.make
	sed -i -e 's,$(datadir)/omf,$(datadir)/../omf,' ${WORKDIR}/quarry-0.2.0/help/C/Makefile.in
	sed -i -e 's,$(datadir)/mime,$(datadir)/../mime,' ${WORKDIR}/quarry-0.2.0/data/Makefile.in
	sed -i -e 's,$(datadir)/locale,$(datadir)/../locale,' ${WORKDIR}/quarry-0.2.0/po/Makefile.in.in
	sed -i -e 's,$(datadir)/locale,$(datadir)/../locale,' ${WORKDIR}/quarry-0.2.0/src/Makefile.in
	sed -i -e 's,$(datadir)/pixmaps,$(datadir)/../pixmaps,' ${WORKDIR}/quarry-0.2.0/data/Makefile.in
	sed -i -e 's,/pixmaps,/../pixmaps,' ${WORKDIR}/quarry-0.2.0/src/gui-gtk/gui-back-end.c
	sed -i -e 's,$(datadir)/applications,$(datadir)/../applications,' ${WORKDIR}/quarry-0.2.0/data/Makefile.in
	egamesconf $(use_enable nls) || die "Configuration failed"
	emake || die "Compilation failed"
}


src_install() {
	make DESTDIR="${D}" install || die "make install failed"
	dodoc AUTHORS ChangeLog COPYING NEWS README THANKS TODO \
		|| die "dodoc failed"
	prepgamesdirs
}
